#include "common.hpp"

void no_memory()
{
  cerr<<"No memory!"<<endl;
  exit(1);
}

TEST(std, new_handler)
{
  set_new_handler(no_memory);
  typedef long double t_t;
  size_t type_size = sizeof(t_t);
  cout<<"Attempting to allocate "<<type_size<<"GB"<<endl;
  t_t* a = new t_t[1024*1024*1024];
  cout<<"OK!"<<endl;
  delete [] a;
}


TEST(std, sizeof)
{
  int data[] = {1,2,3,4,5};
  size_t d =  sizeof(data)/sizeof(int);
  size_t f = 5;
#define K  5
  //EXPECT_EQ(5, d);//type wrong (with int and unsigned int)
  //EXPECT_EQ(K, d);//like above
    EXPECT_EQ(f, d);
}
